@extends('backstage.layout.master')
@section('title', '订单详情')
@section('style')
        <!-- page specific plugin styles -->
<link rel="stylesheet" href="backstage/assets/css/jquery-ui-1.10.3.custom.min.css"/>
<link rel="stylesheet" href="backstage/assets/css/chosen.css"/>
<link rel="stylesheet" href="backstage/assets/css/datepicker.css"/>
<link rel="stylesheet" href="backstage/assets/css/bootstrap-timepicker.css"/>
<link rel="stylesheet" href="backstage/assets/css/daterangepicker.css"/>
<link rel="stylesheet" href="backstage/assets/css/colorpicker.css"/>

<!-- fonts -->
<style>
    .ace-file-input input[type=file]{
        position:static;
    }
    .ace-nav {
        height: 10px;
    }
    #container_id{
        align-content: center;
    }
    .detail-create td{
        background-color: #f5f5f5;
    }
</style>
@stop
@section('script')
    <script>
        function updinvo(){
            var invoice_type    = $("#invoice_type option:selected").val();
            var invoice_class   = $("#invoice_class option:selected").val();
            var invoice_title   = $("#invoice_title").val();
            var order_id        = $("#order_id").val();
            $.ajax({
                url:"/backstage/order/upd-order-invo",
                type:"post",
                data:{"invoice_type":invoice_type,"invoice_class":invoice_class,"invoice_title":invoice_title,"order_id":order_id},
                datatype:"json",
                success:function(re){
                    if(re.state=="M00000"){
                        swal(re.message,'','success');
                        return;
                    }
                    swal(re.message,'','warning');
                    return;
                },
                error:function(){
                    swal('系统繁忙','请稍后重试','warning');
                    return;
                }
            });
        }
        function updexpress(){
            var order_express_id= $("#order_express_id").val();
            var order_id        = $("#order_id").val();
            var express_id      = $("#express_id option:selected").val();
            if(order_express_id==''||order_express_id==undefined){
                swal('请输入快递单号','','warning');
                return;
            }
            console.log(order_express_id,order_id,express_id);
            $.ajax({
                url:"/backstage/order/order-send",
                type:"post",
                data:{"order_express_id":order_express_id,"order_id":order_id,"express_id":express_id},
                datatype:'json',
                success:function(re){
                    if(re.state=="M00000"){
                        swal(re.message,'','success');
                        return;
                    }
                    swal(re.message,'','warning');
                    return;
                },
                error:function(){
                    swal('系统繁忙','请稍后重试','warning');return;
                }
            });
        }
        function updpay(){
            var pay_state       = $("#pay_state option:selected").val();
            var order_id        = $("#order_id").val();
            var pay_type        = $("#pay_type option:selected").val();

            $.ajax({
                url:"/backstage/order/upd-order-pay",
                type:"post",
                data:{"pay_state":pay_state,"order_id":order_id,"pay_type":pay_type},
                datatype:'json',
                success:function(re){
                    if(re.state=="M00000"){
                        swal(re.message,'','success');
                        return;
                    }
                    swal(re.message,'','warning');
                    return;
                },
                error:function(){
                    swal('系统繁忙','请稍后重试','warning');return;
                }
            });
        }

        function updrece(){
            var consignee       = $("#consignee").val();
            var phone           = $("#phone").val();
            var address         = $("#address").val();
            var order_id        = $("#order_id").val();
            $.ajax({
                url:"/backstage/order/update-order-rece",
                type:"post",
                data:{"consignee":consignee,"order_id":order_id,'phone':phone,'address':address},
                datatype:'json',
                success:function(re){
                    if(re.state=="M00000"){
                        swal(re.message,'','success');
                        return;
                    }
                    swal(re.message,'','warning');
                    return;
                },
                error:function(){
                    swal('系统繁忙','请稍后重试','warning');return;
                }
            });
        }

        function updbackmes(){
            var back_mes    = $("#back_message").val();
            var order_id    = $("#order_id").val();
            $.ajax({
                url:"/backstage/order/update-order-back-message",
                type:"post",
                data:{'order_id':order_id,'back_message':back_mes},
                datatype:"json",
                success:function(re){
                    if(re.state=="M00000"){
                        swal(re.message,'','success');
                        return;
                    }
                    swal(re.message,'','warning');
                    return;
                },
                error:function(){
                    swal('系统繁忙','请稍后重试','warning');return;
                }
            });
        }

        function createDown(){
            var order_id    = $("#order_id").val();
            $.ajax({
                url:"/backstage/order/create-order-zip",
                type:"post",
                data:{"order_id":order_id},
                datatype:"json",
                success:function(re){
                    if(re.state=="M00000"){
                        window.location.href=re.result.url;
                        return;
                    }
                    swal(re.message,'','warning');
                    return;
                },
                error:function(){
                    swal('系统繁忙','请稍后重试','warning');return;
                }
            });
        }

        function update_print(th,type){
            swal('处理中','请稍后','warning');
            $.ajax({
                url:"/backstage/order/update-order-print-state",
                type:"post",
                data:{"order_detail_number":th,"state":type},
                datatype:'json',
                success:function(re){
                    if(re.state=="M00000"){
                        swal(re.message,'','success');
                        location.reload();
                        return;
                    }
                    swal(re.message,'','warning');
                    return;
                },
                error:function(){
                    swal('系统繁忙','请稍后重试','warning');return;
                }
            });
        }

        function close_worksheet(th){
            var order_id    = $("#order_id").val();
            $.ajax({
                url:"/backstage/order/close-worksheet",
                type:"post",
                data:{"order_id":order_id,"worksheet_id":th},
                datatype:'json',
                success:function(re){
                    if(re.state=="M00000"){
                        swal(re.message,'','success');
                        location.reload();
                        return;
                    }
                    swal(re.message,'','warning');
                    return;
                },
                error:function(){
                    swal('系统繁忙','请稍后重试','warning');return;
                }
            });
        }
        function order_confirm(){
            var order_id    = $("#order_id").val();
            $.ajax({
                url:"/backstage/order/order-confirm",
                type:"post",
                data:{"order_id":order_id},
                datatype:'json',
                success:function(re){
                    if(re.state=="M00000"){
                        swal(re.message,'','success');
                        location.reload();
                        return;
                    }
                    swal(re.message,'','warning');
                    return;
                },
                error:function(){
                    swal('系统繁忙','请稍后重试','warning');return;
                }
            });
        }
    </script>

@stop
@section('content')
    <div class="breadcrumbs" id="breadcrumbs">
        <script type="text/javascript">
            try {
                ace.settings.check('breadcrumbs', 'fixed')
            } catch (e) {
            }
        </script>
        <ul class="breadcrumb">
            <li>
                <i class="icon-home home-icon"></i>
                <a href="/" target="_blank">主页</a>
            </li>
            <li class="active">
                <a href="/backstage/order/order-list">订单列表</a>
            </li>
        </ul><!-- .breadcrumb -->
    </div>
    <div class="page-content">
        <div class="row">
            <div class="col-xs-12">
                <!-- PAGE CONTENT BEGINS -->
                <div class="page-header">
                    <h1>
                        订单
                        <small>
                            <i class="icon-double-angle-right"></i>
                            订单详情
                        </small>
                    </h1>
                </div>
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="table-responsive">
                            <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                                <tr>
                                    <td>订单编号</td>
                                    <td colspan="1">
                                        {{isset($order->order_id)?$order->order_id:''}}
                                    </td>
                                    <div class="col-sm-9" style="display:none;">
                                        <input type="text" id="order_id" class="col-xs-10 col-sm-5" value="{{isset($order->order_id)?$order->order_id:''}}" readonly="true"/>
                                    </div>
                                    <td>用户编号</td>
                                    <td colspan="3">
                                        {{isset($order->buyer_id)?$order->buyer_id:''}}
                                    </td>
                                </tr>
                                <tr>

                                </tr>
                                <tr>
                                    <td>订单状态</td>
                                    <td>

                                        @if($order->is_cancel==0&&$order->state==1)
                                            等待支付
                                        @elseif($order->is_cancel==0&&$order->state==2)
                                            等待发货
                                        @elseif($order->is_cancel==0&&$order->state==3)
                                            等待签收
                                        @elseif($order->is_cancel==0&&$order->state==4)
                                            已完成
                                        @elseif($order->is_cancel==1&&$order->state!=0)
                                            已取消
                                        @elseif($order->state==0)
                                            已删除
                                        @else
                                            未知
                                        @endif
                                    </td>
                                    <td>下单时间</td>
                                    <td colspan="3">
                                        {{isset($order->created_at) ? date('Y-m-d H:i:s',$order->created_at):''}}
                                    </td>
                                </tr>
                                <!-- <tr>
                                    <td>是否申请售后</td>
                                    <td colspan="5">
                                        <select id="order_state" disabled="disabled">
                                            @if(isset($result->order))
                                            @if($result->order->is_cancel==1)
                                            <option value ="1" selected="selected">是</option>
                                            <option value ="0">否</option>
                                            @else
                                            <option value ="1">是</option>
                                            <option value ="0" selected="selected">否</option>
                                            @endif
                                            @endif
                                        </select>
                                    </td>
                                </tr> -->
                                <!-- @if(isset($result->order->is_cancel)&&$result->order->is_cancel==1)

                                <tr>
                                    <td>申请售后类型</td>
                                    <td colspan="5">
                                        <input type="text" id="aftertype" style="width:190px;" value="{{isset($result->order->type_str)?$result->order->type_str:''}}"
                                        class="col-xs-10 col-sm-5" readonly="true">
                                    </td>
                                </tr>
                                <tr>
                                    <td>申请售后信息</td>
                                    <td colspan="5">
                                        <textarea class="form-control" name="message"id="aftermes" readonly="readonly">{{isset($result->order->aftermark_mes)?$result->order->aftermark_mes:''}}</textarea>
                                    </td>
                                </tr>
                                <tr>
                                    <td>售后处理进度</td>
                                    <div class="col-sm-9" style="display:none;">
                                        <input type="text" id="id" class="col-xs-10 col-sm-5" value="{{isset($result->order->after_id)?$result->order->after_id:''}}" readonly="true"/>
                                    </div>
                                    <td colspan="5">
                                        <select id="after_state">
                                            @if(isset($result->order->after_state))
                                            <option value ="2"@if($result->order->after_state==2) selected="selected"@endif>同意申请</option>
                                            <option value ="0"@if($result->order->after_state==0) selected="selected"@endif>拒绝申请</option>
                                            <option value ="3"@if($result->order->after_state==3) selected="selected"@endif>处理完成</option>
                                            @endif
                                        </select>
                                        &nbsp &nbsp<button onclick="updafterstate()">修改售后进度</button>
                                    </td>
                                </tr>

                                @endif -->
                                <tr class="">
                                    <td>支付状态</td>
                                    <td>
                                        @if(isset($order->pay_state)&&$order->pay_state==0)
                                        未支付
                                        @elseif(isset($order->pay_state)&&$order->pay_state==1)
                                        支付处理中
                                        @elseif(isset($order->pay_state)&&$order->pay_state==2)
                                        已支付
                                        @endif
                                    </td>
                                    <td>支付时间</td>
                                    <td colspan="3">
                                        {{isset($order->pay_time_str) ? $order->pay_time_str : ''}}
                                    </td>
                                </tr>
                                <tr>
                                    <td>支付方式</td>
                                    <td>
                                        @if(isset($order->pay_type)&&$order->pay_type==0)
                                        未支付
                                        @elseif(isset($order->pay_type)&&$order->pay_type==1)
                                        微信
                                        @elseif(isset($order->pay_type)&&$order->pay_type==2)
                                        支付宝
                                        @elseif(isset($order->pay_type)&&$order->pay_type==3)
                                        优惠券
                                        @endif
                                    </td>
                                    <td>发货时间</td>
                                    <td colspan="3">
                                        {{isset($order->send_time_str) ? $order->send_time_str :''}}
                                    </td>
                                </tr>
                                <tr>
                                    <td>第三方支付交易号</td>
                                    <td colspan="1">
                                        {{isset($order->trade_no)?$order->trade_no:''}}
                                    </td>

                                    <td>完成时间</td>
                                    <td colspan="3">
                                        {{isset($order->sign_time_str) ? $order->sign_time_str : ''}}
                                    </td>
                                </tr>
                                <tr>
                                    <td>渠道</td>
                                    <td>
                                        {{isset($order->platform) ? $order->platform : ''}}
                                    </td>
                                    <td>取消时间</td>
                                    <td colspan="3">
                                        {{isset($order->cancel_time_str) ? $order->cancel_time_str : ''}}
                                        @if(isset($order->state) && $order->state == 2 && isset($order->is_cancel) && $order->is_cancel == 0)
                                            <a href="/backstage/order/order-cancel-blade?order_id={{isset($order->order_id)?$order->order_id:''}}">
                                                前往取消
                                            </a>
                                        @endif
                                    </td>
                                </tr>
                                </tr>
                                <tr>
                                    <td>是否已进入售后状态</td>
                                    <td colspan="1">
                                        @if(isset($order->is_aftermark)&&$order->is_aftermark==0)
                                        否
                                        @elseif(isset($order->is_aftermark)&&$order->is_aftermark==1)
                                        是
                                        @endif
                                    </td>
                                    <td>当前售后单号</td>
                                    <td colspan="3">
                                        <a href="/backstage/order/after-detail?order_after_id={{isset($order->order_after_id) ? $order->order_after_id : ''}}">
                                        {{isset($order->order_after_id) ? $order->order_after_id : ''}}
                                        </a>
                                    </td>
                                </tr>
                                <tr>
                                    <td>订单确认状态</td>
                                    <td colspan="1">
                                        @if(isset($order) &&
                                            isset($order->state) && $order->state == 2 &&
                                            isset($order->is_confirm) && $order->is_confirm == 0)
                                            <button onclick="order_confirm()">确认</button>
                                        @elseif(isset($order) &&
                                                isset($order->is_confirm) &&
                                                $order->is_confirm == 1)
                                            已确认
                                        @else
                                            未确认
                                        @endif
                                    </td>
                                    <td>订单确认时间</td>
                                    <td colspan="3">
                                        {{isset($order->confirm_time) && $order->confirm_time != 0?
                                          date('Y-m-d H:i:s',$order->confirm_time) : ''}}
                                    </td>
                                </tr>
                                @if(isset($order->cancel))
                                <tr>
                                    <td colspan="6">d订单取消详情</td>
                                </tr>
                                <tr>
                                    <td>取消用户编号</td>
                                    <td>
                                        {{isset($order->cancel->user_id) && $order->cancel->user_id != 0 ? $order->cancel->user_id : ''}}
                                        @if(isset($order->cancel->iden) && $order->cancel->iden == 0)
                                        (系统)
                                        @elseif(isset($order->cancel->iden) && $order->cancel->iden == 1)
                                        (用户)
                                        @elseif(isset($order->cancel->iden) && $order->cancel->iden == 2)
                                        (后台管理员)
                                        @endif
                                    </td>
                                    <td>原因</td>
                                    <td colspan="3">
                                        @if(isset($order->cancel->iden) && $order->cancel->iden == 0)
                                        超时
                                        @else
                                        {{isset($order->cancel_reason) ? $order->cancel_reason : ''}}
                                        @endif
                                    </td>
                                </tr>
                                @endif
                                <tr>
                                    <td>配送方式</td>
                                    <td colspan="5">
                                        <select id="express_id">
                                            @if(isset($express)&&isset($order->express->express_id))
                                            @foreach($express as $exp)
                                            @if($order->express->express_id == $exp->express_id)
                                            <option value ="{{$exp->express_id}}" selected = "selected">{{$exp->express_name}}</option>
                                            @else
                                            <option value ="{{$exp->express_id}}">{{$exp->express_name}}</option>
                                            @endif
                                            @endforeach
                                            @endif
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>快递单号</td>
                                    <td colspan="5">
                                        <input type="text" id="order_express_id" style="width:190px;" value="{{isset($order->express->order_express_id) ? $order->express->order_express_id : ''}}"
                                        class="col-xs-10 col-sm-5">

                                        &nbsp &nbsp<button onclick="updexpress()">修改物流信息</button>

                                    </td>
                                </tr>
                                <!-- <tr>
                                    <td>发票类型</td>
                                    <td colspan="5">
                                        <select id="invoice_type" @if(isset($result->order)&&$result->order->state>=4&&$result->order->state<=7) disabled="disabled" @endif>
                                            @if(isset($result->order))
                                            @if($result->order->invoice_type==0)
                                            <option value ="0" selected = "selected">个人</option>
                                            @else
                                            <option value ="0">个人</option>
                                            @endif
                                            @if($result->order->invoice_type==1)
                                            <option value ="1" selected = "selected">企业</option>
                                            @else
                                            <option value ="1">企业</option>
                                            @endif
                                            @endif
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>发票材质</td>
                                    <td colspan="5">
                                        <select id="invoice_class" @if(isset($result->order)&&$result->order->state>=4&&$result->order->state<=7) disabled="disabled" @endif>
                                            @if(isset($result->order))
                                            @if($result->order->invoice_class==0)
                                            <option value ="0" selected = "selected">电子版</option>
                                            @else
                                            <option value ="0">电子版</option>
                                            @endif
                                            @if($result->order->invoice_class==1)
                                            <option value ="1" selected = "selected">纸质</option>
                                            @else
                                            <option value ="1">纸质</option>
                                            @endif
                                            @endif
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>发票抬头</td>
                                    <td colspan="5">
                                        <input type="text" id="invoice_title" style="width:190px;" value="{{isset($result->order->invoice_title)?$result->order->invoice_title:''}}"
                                        class="col-xs-10 col-sm-5" @if(isset($result->order)&&$result->order->state>=4&&$result->order->state<=7) readonly="true" @endif/>
                                        @if(isset($result->order)&&$result->order->state>=0&&$result->order->state<4)
                                        &nbsp &nbsp<button onclick="updinvo()">修改发票信息</button>
                                        @endif
                                    </td>
                                </tr> -->

                                <!-- <tr>
                                    <td>用户要求发货时间</td>
                                    <td colspan="4">
                                        <input type="text" id="send_time" style="width:190px;" value="{{isset($result->order->user_send_time)?$result->order->user_send_time:''}}"
                                        class="col-xs-10 col-sm-5"
                                        readonly="true"/>
                                    </td>
                                </tr> -->
                                <tr>
                                    <td colspan="6">收货人信息</td>
                                </tr>

                                <tr>
                                    <td>姓名</td>
                                    <td colspan="1">
                                        @if(isset($order->is_cancel) && isset($order->state) && $order->state == 2 && $order->is_cancel == 0)
                                        <input type="text" id="consignee" style="width:190px;" value="{{isset($order->express->consignee)?$order->express->consignee:''}}" class="col-xs-10 col-sm-5"/>
                                        @else
                                        {{isset($order->express->consignee) ? $order->express->consignee : ''}}
                                        @endif
                                    </td>
                                    <td>联系电话</td>
                                    <td colspan="3">
                                        @if(isset($order->is_cancel) && isset($order->state) && $order->state == 2 && $order->is_cancel == 0)
                                        <input type="text" id="phone" style="width:190px;"
                                        value="{{isset($order->express->phone)?$order->express->phone:''}}"
                                        class="col-xs-10 col-sm-5" maxlength="11"/>
                                        @else
                                        {{isset($order->express->phone) ? $order->express->phone : ''}}
                                        @endif
                                    </td>
                                </tr>
                                <tr>
                                    <td>收货地址</td>
                                    <td colspan="5">
                                        @if(isset($order->is_cancel) && isset($order->state) && $order->state == 2 && $order->is_cancel == 0)
                                        <textarea class="form-control" name="address" id="address">{{isset($order->express->address)?$order->express->address:''}}</textarea>
                                        &nbsp &nbsp<button onclick="updrece()">修改收货信息</button>
                                        @else
                                        {{isset($order->express->address)?$order->express->address:''}}
                                        @endif
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="6">订单详情</td>
                                </tr>
                                <tr>
                                    <td>作品图片</td>
                                    <td>产品模版名称 | 品牌 |产品编号</td>
                                    <td>颜色 | 尺码</td>
                                    <td>单价 x 数量</td>
                                    <td>小计</td>
                                    <td>备货进度</td>
                                </tr>

                                @if(isset($order->detail) && isset($order->detail['vaild']))

                                @foreach ($order->detail['vaild'] as $detail)
                                <tr class="detail-create">
                                    <td width="230px">
                                        <img src="{{isset($detail->thumbnail[0]) ? $detail->thumbnail[0] : ''}}"
                                            title="产品图片" width="100px"/>
                                            {{isset($detail->order_detail_number) ? $detail->order_detail_number : ''}}
                                    </td>
                                    <td>
                                        <a href="/backstage/products/detail/{{isset($detail->product_id)?$detail->product_id:''}}" title="点击查看产品信息">
                                        {{isset($detail->product_temp_name) ? $detail->product_temp_name : ''}} |
                                        {{isset($detail->brand_name) ? $detail->brand_name : ''}} |
                                        {{isset($detail->product_id) ? $detail->product_id : ''}}
                                        </a>
                                    </td>
                                    <td>
                                        {{isset($detail->colour_name)?$detail->colour_name:''}} | {{isset($detail->size_name)?$detail->size_name:''}}
                                    </td>
                                    <td>
                                        {{isset($detail->preferential_price)?$detail->preferential_price:''}} x
                                        {{isset($detail->quantity)?$detail->quantity:''}}
                                    </td>
                                    <td>
                                        <a>￥ {{isset($detail->preferential_price)&&isset($detail->preferential_price) ? $detail->preferential_price * $detail->quantity : ''}}</a>
                                    </td>
                                    <td>
                                        @if(isset($order->pay_state) && $order->pay_state != 2)
                                        未开始
                                        @elseif(isset($detail->print_state) && $detail->print_state == 0)
                                        <button onclick="update_print('{{isset($detail->order_detail_number) ? $detail->order_detail_number : ''}}',1)">
                                        开始
                                        </button>
                                        @elseif(isset($detail->print_state) && $detail->print_state == 1)
                                        <button onclick="update_print('{{isset($detail->order_detail_number) ? $detail->order_detail_number : ''}}',2)">
                                        完成
                                        </button>
                                        @else
                                        已完成
                                        @endif
                                    </td>
                                </tr>
                                @if(isset($detail->gift))
                                @foreach($detail->gift as $gift)
                                <tr>
                                    <td colspan="1"></td>
                                    <td style="background-color: #fff;" colspan="5">
                                        [赠品]{{isset($gift->name)?$gift->name:''}} [数量]{{isset($gift->quantity)?$gift->quantity:''}}
                                    </td>
                                </tr>
                                @endforeach
                                @endif
                                <tr>
                                    <td></td>
                                    <td colspan="5">资费明细</td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>图片</td>
                                    <td>名称</td>
                                    <td>类型</td>
                                    <td>收费金额</td>
                                    <td></td>
                                </tr>
                                @if(isset($detail->lists))
                                @foreach($detail->lists as $list)
                                <tr>
                                    <td></td>
                                    <td>
                                        <img src="{{isset($list->thumbnail) ? $list->thumbnail : ''}}"
                                            title="图片" width="100px"/>
                                    </td>
                                    <td>
                                        {{isset($list->title) ? $list->title : ''}}
                                    </td>
                                    <td>
                                        @if(isset($list->type) && $list->type == 1)
                                        产品模版
                                        @elseif(isset($list->type) && $list->type == 2)
                                        用户上传素材
                                        @elseif(isset($list->type) && $list->type == 3)
                                        系统库素材
                                        @elseif(isset($list->type) && $list->type == 4)
                                        字体
                                        @elseif(isset($list->type) && $list->type == 5)
                                        溢价
                                        @endif
                                    </td>
                                    <td>
                                        {{isset($list->preferential_price) ? sprintf("%1\$.2f", $list->preferential_price) : ''}}
                                    </td>
                                    <td>

                                    </td>
                                </tr>
                                @endforeach
                                @endif
                                @endforeach
                                @else
                                <tr>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                @endif
                                <tr>
                                    <td colspan="6"><a class="btn" onclick="createDown()">下载打印图片包</a><a id="download"></a></td>
                                </tr>
                                <tr>
                                    <td colspan="1">
                                        备货发货花费时间
                                    </td>
                                    <td colspan="5">
                                        <?php
                                            if(isset($order->send_time_str) &&
                                                isset($order->pay_time_str) &&
                                                $order->send_time_str != '' &&
                                                $order->pay_time_str != ''){
                                                $time = strtotime($order->send_time_str) - strtotime($order->pay_time_str);
                                                $hour = intval($time/3600);
                                                $min  = intval(($time - $hour * 3600)/60);
                                                $s    = $time - $hour * 3600 - $min * 60;
                                                $str  = '';
                                                if($hour > 0) $str .= $hour . '小时';
                                                if($min > 0)  $str .= $min . '分钟';
                                                if($s > 0)    $str .= $s . '秒';
                                                echo $str;
                                            }
                                        ?>
                                    </td>
                                </tr>
                                <tr>
                                    <td>运费</td>
                                    <td colspan="5">
                                        {{isset($order->total_postage) ? $order->total_postage : ''}}
                                    </td>
                                </tr>
                                <tr>
                                    <td>优惠券</td>
                                    <td>
                                        {{isset($order->coupon->coupon_id) ? $order->coupon->coupon_id : ''}}
                                    </td>
                                    <td>优惠券实际抵用金额</td>
                                    <td colspan="3">
                                        {{isset($order->coupon->coupon_price) ? $order->coupon->coupon_price : ''}}
                                    </td>
                                </tr>
                                <tr>
                                    <td>活动渠道编号</td>
                                    <td>
                                        {{isset($order->channel_id) ? $order->channel_id : ''}}
                                    </td>
                                    <td>活动优惠金额</td>
                                    <td colspan="3">
                                        @if(isset($order->channel_id) && $order->channel_id != '')
                                        {{isset($order->discount_price) ? $order->discount_price : ''}}
                                        @else
                                        0
                                        @endif
                                    </td>
                                </tr>
                                <tr>
                                    <td>实际支付</td>
                                    <td colspan="5">
                                        {{isset($order->total_fee) ? sprintf("%1\$.2f",$order->total_fee) : ''}}
                                    </td>
                                </tr>
                                <tr>
                                    <td>总计金额</td>
                                    <td colspan="5">
                                        {{isset($order->detail['total_price']) ? sprintf("%1\$.2f",$order->detail['total_price']) : ''}}
                                        <!-- @if(isset($result->order)&&$result->order->state>=0&&$result->order->state<4)
                                        &nbsp &nbsp<button onclick="updtotal()" >修改订单金额</button>
                                        @endif -->
                                    </td>
                                </tr>
                                <tr>
                                    <td>工单号</td>
                                    <td colspan="1">
                                        {{isset($order->worksheet_id) ? $order->worksheet_id : ''}}
                                    </td>
                                    <td>工单状态</td>
                                    <td colspan="3">
                                        @if(isset($order->worksheet_id) &&
                                            $order->worksheet_id != '' &&
                                            isset($order->enabled_worksheet) &&
                                            $order->enabled_worksheet)
                                        有效 &nbsp
                                        <button onclick="close_worksheet('{{isset($order->worksheet_id) ? $order->worksheet_id : ''}}')">
                                            关闭工单
                                        </button>
                                        @elseif(isset($after->worksheet_id) &&
                                                $after->worksheet_id == '' )
                                        未绑定工单
                                        @else
                                        已关闭
                                        @endif
                                    </td>
                                </tr>
                                <tr>
                                    <td>用户备注</td>
                                    <td colspan="5">
                                        {{empty($order->message)?'':pack('H*',$order->message)}}
                                    </td>
                                </tr>
                                @if(isset($order))
                                <tr>
                                    <td>后台备注</td>
                                    <td colspan="5">
                                        <textarea class="form-control" name="back_mes" id="back_message" >{{empty($order->back_message)?'':pack('H*',$order->back_message)}}</textarea>
                                        &nbsp &nbsp<button onclick="updbackmes()">修改后台备注</button>
                                    </td>
                                </tr>
                                @endif
                            </table>
                        </div>

                </div>
                <!-- PAGE CONTENT ENDS -->
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.page-content -->
@stop
